<?php 
	session_start();
include_once '../pushing.php';

if ($pushTime == true) {
	if ($_SESSION['UserId'] != 3)
		header('Location: push.php');
}
	
	if(!isset($_SESSION['UserId']))
	{
		header('Location: login.php');
   		die();
	}
	
	include_once ('../Functions/GeneralFunctions.php');
   
	$conn = GetConnection();
	if (isset($_REQUEST['SID'])){
		$sql = "SELECT Title FROM Section WHERE ID = '$_REQUEST[SID]'";
		$result = $conn->query($sql);
		$rs2 = $result->fetch_assoc();
	}
	function getPatientInfo()
	{
		$conn = GetConnection();
		$sql = "SELECT ID, PatID FROM Patient ORDER BY PatID";
		$value = $conn->query($sql);
		return $value;	
		$conn->close();
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Choose Patient</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../Styler.css"/>
</head>

<body>

<div id="header">
            <div class="pageTitleText">Choose Patient</div>
</div>
    
    <div id="mainMenu" >
    	<ul style="list-style: none outside none;">
	        
	        <li>
	         	<a href="choosePatient.php?SID=10">Patient ICD9</a>
	        </li>
	        
	        <li>
	         	<a href="choosePatient.php?SID=4">Patient Prescription</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=2">Physical Symptoms</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=5">Neuropsychological Symptoms</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=3">Psychological Test</a> 
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=6">Diagnostic Test</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=8">View Patient Information</a>
	        </li>
	        
	        <li>
	         	<a href="choosePatient.php?SID=7">Edit Patient Information</a>
	        </li>
	        
	        <li>
	        	<a href="choosePatient.php?SID=9">Save Patient Information</a>
	        </li>
	        
	       <li style="border-bottom: 1px solid #FD9D45;">
	       	 	<del><!--<a href="query.php">-->Query<!--</a>--></del>
	        </li>
	        
	        <li>
	       	 	<a href="home.php">Home</a>
	        </li> 
	         
	        <li>
	       	 	<a href="logout.php">Logout</a>
	        </li>
	        
        </ul>
     </div>
    

 <div class="formContainer">
<div id="login" style="top: 10px; margin: 0px;"> 
        <form name="QuestionnaireTitles">
                <select name="PatName">
                   <option value=''>- Patient ID -</option>
                    <?php $results = getPatientInfo();
              			while ($rs = $results->fetch_assoc()): 
							if (isset($_REQUEST['SID'])) {?>
                        	<option value="<?php echo $rs2['Title']?>.php?PatId=<?php echo $rs['ID']?>"><?php echo $rs['PatID']?></option> 
                        <?php } else { ?>
							<option value="<?php echo $_REQUEST['page']?>?PatId=<?php echo $rs['ID']?>"><?php echo $rs['PatID']?></option> 
						<?php	}
						endwhile?>
                </select>
         	<div id="questionnaire">
	            <div class="mainbody">
	            	<div id="QuesButton">
	            	 <input type="button" value="Choose" class="loginButton" onclick="window.location=document.QuestionnaireTitles.PatName.options[document.QuestionnaireTitles.PatName.selectedIndex].value" style="margin-top: 0px;"/>
	                	<!--<input type="button" class="finishButton" value="CHOOSE" onclick="window.location=document.QuestionnaireTitles.PatName.options[document.QuestionnaireTitles.PatName.selectedIndex].value"/>-->
	                </div>
	           	</div>
        	</div>
        </form>
</div>
</div>
</body>
</html>